import type { PurchaseContractDetailVO, PurchaseContractDetailForm, PurchaseContractDetailQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
* 查询采购合同明细列表
* @param params
* @returns 采购合同明细列表
*/
export function purchaseContractDetailList(params?: PurchaseContractDetailQuery) {
  return requestClient.get<PageResult<PurchaseContractDetailVO>>('/trade/purchaseContractDetail/list', { params });
}

/**
 * 导出采购合同明细列表
 * @param params
 * @returns 采购合同明细列表
 */
export function purchaseContractDetailExport(params?: PurchaseContractDetailQuery) {
  return commonExport('/trade/purchaseContractDetail/export', params ?? {});
}

/**
 * 查询采购合同明细详情
 * @param id id
 * @returns 采购合同明细详情
 */
export function purchaseContractDetailInfo(id: ID) {
  return requestClient.get<PurchaseContractDetailVO>(`/trade/purchaseContractDetail/${id}`);
}

/**
 * 新增采购合同明细
 * @param data
 * @returns void
 */
export function purchaseContractDetailAdd(data: PurchaseContractDetailForm) {
  return requestClient.postWithMsg<void>('/trade/purchaseContractDetail', data);
}

/**
 * 更新采购合同明细
 * @param data
 * @returns void
 */
export function purchaseContractDetailUpdate(data: PurchaseContractDetailForm) {
  return requestClient.putWithMsg<void>('/trade/purchaseContractDetail', data);
}

/**
 * 删除采购合同明细
 * @param id id
 * @returns void
 */
export function purchaseContractDetailRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/trade/purchaseContractDetail/${id}`);
}
